Skip to content

Conversation

@JoeGruffins
Copy link
Member

Moves old db aside and warns.

@JoeGruffins JoeGruffins marked this pull request as draft January 19, 2026 09:50
@JoeGruffins JoeGruffins force-pushed the updatebadgerv4 branch 2 times, most recently from 35fcec3 to bf78e7c Compare January 20, 2026 06:04
@JoeGruffins JoeGruffins marked this pull request as ready for review January 20, 2026 06:04
@jrick
Copy link
Member

jrick commented Jan 20, 2026

I don't believe just setting the old db aside and creating a new one is OK. There needs to be some sort of migration.

I suggest making a new db directory with the version in the directory name. (not sure if this should be the module's major version, or the current manifest version of 8, they have done some wacky versioning in the past but it appears like they might be updating both versions in lockstep going forward?) When the current version does not exist, look for the most recent previous version, and then do the Backup/Load.

@JoeGruffins JoeGruffins force-pushed the updatebadgerv4 branch 2 times, most recently from 9f76a57 to 553cc37 Compare January 21, 2026 03:16
@JoeGruffins
Copy link
Member Author

JoeGruffins commented Jan 21, 2026

Updating the old db, seems to be working https://github.com/decred/dcrdex/compare/9f76a57b92e382375353796734e1bae44bbf92a4..553cc37d628a95044498d86b9474a0adc4d91f74

So, versioning from now, would be best to make separate folders like, v4, v5, makes sense...

We can also just worry about that next update. But idk if we can know the current version easily.

@JoeGruffins
Copy link
Member Author

Oh sorry, must be doing something wrong atm [WRN] CORE[eth][TXDB][BADG]: Unable to update old db, creating new one: read /home/joe/.dexc/simnet/assetdb/eth/txhistorydb-lexi.temp: bad file descriptor fixing...

@JoeGruffins JoeGruffins force-pushed the updatebadgerv4 branch 2 times, most recently from 2681781 to 614222c Compare January 21, 2026 06:12
Comment on lines +88 to +76
tempF.Close()
tempF, err = os.OpenFile(tempPath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think you could just do tempF.Sync() but that does not seem to work.

@JoeGruffins
Copy link
Member Author

Working now, thinking about future upgrades.

@JoeGruffins JoeGruffins force-pushed the updatebadgerv4 branch 2 times, most recently from 2f3e852 to 5d6b024 Compare January 21, 2026 08:36
@JoeGruffins
Copy link
Member Author

Adds a version tag to the end of database paths so we know before attempting to open which version of badger the database is currently created with.

@JoeGruffins
Copy link
Member Author

Adjusted so New can point at an existing v4 db when using the new lexi tool.

The truncate option does not exist in this version, so this also removes the
ErrTruncateNeeded handling.
@JoeGruffins JoeGruffins force-pushed the updatebadgerv4 branch 2 times, most recently from 934d81e to 7d31ddc Compare January 22, 2026 06:47
Copy link
Collaborator

@martonp martonp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JoeGruffins
Copy link
Member Author

@JoeGruffins JoeGruffins merged commit a8f7174 into decred:master Jan 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants